package com.zou.practice;

import com.zou.practice.sip.IHello;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.util.StopWatch;

import java.util.ServiceLoader;

/**
 * @author zouyaowen
 * @date 2020-08-16
 */
@SpringBootApplication
@Slf4j
public class StartApplication {
    public static void main(String[] args) {
        StopWatch stopWatch = new StopWatch("Best Practice Application");
        stopWatch.start("Best Practice Application");
        SpringApplication.run(StartApplication.class, args);
        stopWatch.stop();
        log.info("启动耗时={}秒", stopWatch.getTotalTimeSeconds());
        log.info(stopWatch.prettyPrint());

        //SIP机制 测试
        ServiceLoader<IHello> loader = ServiceLoader.load(IHello.class);
        for (IHello hello : loader) {
            log.info(hello.getClass().toString());
            hello.sayHello();
        }
    }
}
